package spring.spi;

import org.junit.Test;
import org.springframework.core.io.support.SpringFactoriesLoader;

import java.util.List;

/**
 * Spring SPI 测试类
 *
 * @author ME
 * @date 2021/5/8
 */
public class TestSpringSPI {

    @Test
    public void sayHello() {
        List<Robot> robots =
                SpringFactoriesLoader.loadFactories(Robot.class, TestSpringSPI.class.getClassLoader());

        for (Robot robot : robots) {
            robot.sayHello();
        }
    }
}
